# 选择排序法
def select_sort_simple(li):
    """
    选择排序法
    时间复杂度 O(n³)

    for循环一次n
    min一次n
    remove一次n

    li_new消耗更大内存

    :param li:
    :return:
    """
    li_new = []

    for i in range(len(li)):
        min_val = min(li)
        li_new.append(min_val)
        li.remove(min_val)

    return li_new


# 选择排序法 -- 优化版
def select_sort(li):
    for i in range(len(li) - 1):  # i是第几趟
        min_loc = i
        for j in range(i+1, len(li)):
            if li[j] < li[min_loc]:
                min_loc = j
        li[i], li[min_loc] = li[min_loc], li[i]
        # print(li)


if __name__ == "__main__":
    li = [20]
    select_sort(li)
    print(list(range(100)))
